﻿using System;
using WmsApp.WindowControl;

namespace WmsApp.WmsService
{
    public partial class InStoreBillDtl : IWcfState
    {
        public static InStoreBillDtl CreateInStoreBillDtl(string billID)
        {
            var inStoreBillDtl = new InStoreBillDtl
            {
                BillID = billID,
                BillDtlID = Guid.NewGuid().ToString(),
                TaxRate = InStoreBillController.StaticTaxRate,
                SpecificationType="",
                AmountNotTax = 0,
                AmountTax = 0,
                PriceTax = 0,
                PriceNotTax = 0,
                Quantity = 1,
                WcfEntityState = System.Data.EntityState.Added
            };
            inStoreBillDtl.BindPropertyChanged();
            return inStoreBillDtl;
        }

        public decimal RemainAmountTax
        {
            get { return this.AmountTax - (this.InvoiceDtlTotalAmountTax ?? 0); }
        }

        public void BindPropertyChanged()
        {
            this.PropertyChanged += WmsApp.EntityControl.PropertyChangedHandler.EntityObjectPropertyChanged;
        }
    }
}
